﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;

namespace Dominar.Controllers
{
    public class AuthController : BaseController
    {
        private void Autenticar(string usuario)
        {
            FormsAuthentication.Initialize();
            FormsAuthenticationTicket fat = new FormsAuthenticationTicket(1, usuario, DateTime.Now, DateTime.Now.AddDays(30), true, @"", FormsAuthentication.FormsCookiePath);
            HttpContext.Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(fat)));
        }


        public ActionResult Index()
        {
            Autenticar("gerardito");
            return RedirectToAction("Index", "Dominio");
        }
    }
}